from django.utils.deprecation import MiddlewareMixin


class NotUseCsrfTokenMiddlewareMixin(MiddlewareMixin):

    def process_request(self, request):
        if request.path_info.endswith('upload/'):
            setattr(request, '_dont_enforce_csrf_checks', True)